import asyncio
import argparse
from vehicle.vehicle_controller import VehicleController
from scheduler.scheduler import Scheduler

if __name__ == "__main__":
    # 解析命令行参数
    parser = argparse.ArgumentParser(description='远程RC车控制程序')
    parser.add_argument('--controller_type', type=str, default='DifferentialDrive',
                        choices=['DifferentialDrive', 'OmniDrive', 'SteeringDrive'],
                        help='选择电机控制器类型 (默认: DifferentialDrive)')
    args = parser.parse_args()
    
    # 根据参数创建控制器
    controller = VehicleController(controller_type=args.controller_type)
    print(f"已启动RC车控制程序，使用{controller.get_controller_type()}控制器")
    
    # 启动调度器和控制器
    scheduler = Scheduler(args)
    asyncio.run(scheduler.start())
